#pragma once
// MESSAGE FO_GYRO PACKING

#define MAVLINK_MSG_ID_FO_GYRO 34

MAVPACKED(
typedef struct __mavlink_fo_gyro_t {
 int32_t state; /*<  state.*/
 float wib[3]; /*<  wib.*/
 float temprature; /*<  temprature.*/
}) mavlink_fo_gyro_t;

#define MAVLINK_MSG_ID_FO_GYRO_LEN 20
#define MAVLINK_MSG_ID_FO_GYRO_MIN_LEN 20
#define MAVLINK_MSG_ID_34_LEN 20
#define MAVLINK_MSG_ID_34_MIN_LEN 20

#define MAVLINK_MSG_ID_FO_GYRO_CRC 228
#define MAVLINK_MSG_ID_34_CRC 228

#define MAVLINK_MSG_FO_GYRO_FIELD_WIB_LEN 3

#if MAVLINK_COMMAND_24BIT
#define MAVLINK_MESSAGE_INFO_FO_GYRO { \
    34, \
    "FO_GYRO", \
    3, \
    {  { "state", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_fo_gyro_t, state) }, \
         { "wib", NULL, MAVLINK_TYPE_FLOAT, 3, 4, offsetof(mavlink_fo_gyro_t, wib) }, \
         { "temprature", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_fo_gyro_t, temprature) }, \
         } \
}
#else
#define MAVLINK_MESSAGE_INFO_FO_GYRO { \
    "FO_GYRO", \
    3, \
    {  { "state", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_fo_gyro_t, state) }, \
         { "wib", NULL, MAVLINK_TYPE_FLOAT, 3, 4, offsetof(mavlink_fo_gyro_t, wib) }, \
         { "temprature", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_fo_gyro_t, temprature) }, \
         } \
}
#endif

/**
 * @brief Pack a fo_gyro message
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 *
 * @param state  state.
 * @param wib  wib.
 * @param temprature  temprature.
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_fo_gyro_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
                               int32_t state, const float *wib, float temprature)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_FO_GYRO_LEN];
    _mav_put_int32_t(buf, 0, state);
    _mav_put_float(buf, 16, temprature);
    _mav_put_float_array(buf, 4, wib, 3);
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FO_GYRO_LEN);
#else
    mavlink_fo_gyro_t packet;
    packet.state = state;
    packet.temprature = temprature;
    mav_array_memcpy(packet.wib, wib, sizeof(float)*3);
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FO_GYRO_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_FO_GYRO;
    return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FO_GYRO_MIN_LEN, MAVLINK_MSG_ID_FO_GYRO_LEN, MAVLINK_MSG_ID_FO_GYRO_CRC);
}

/**
 * @brief Pack a fo_gyro message on a channel
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param state  state.
 * @param wib  wib.
 * @param temprature  temprature.
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_fo_gyro_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
                               mavlink_message_t* msg,
                                   int32_t state,const float *wib,float temprature)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_FO_GYRO_LEN];
    _mav_put_int32_t(buf, 0, state);
    _mav_put_float(buf, 16, temprature);
    _mav_put_float_array(buf, 4, wib, 3);
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FO_GYRO_LEN);
#else
    mavlink_fo_gyro_t packet;
    packet.state = state;
    packet.temprature = temprature;
    mav_array_memcpy(packet.wib, wib, sizeof(float)*3);
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FO_GYRO_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_FO_GYRO;
    return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FO_GYRO_MIN_LEN, MAVLINK_MSG_ID_FO_GYRO_LEN, MAVLINK_MSG_ID_FO_GYRO_CRC);
}

/**
 * @brief Encode a fo_gyro struct
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 * @param fo_gyro C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_fo_gyro_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_fo_gyro_t* fo_gyro)
{
    return mavlink_msg_fo_gyro_pack(system_id, component_id, msg, fo_gyro->state, fo_gyro->wib, fo_gyro->temprature);
}

/**
 * @brief Encode a fo_gyro struct on a channel
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param fo_gyro C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_fo_gyro_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_fo_gyro_t* fo_gyro)
{
    return mavlink_msg_fo_gyro_pack_chan(system_id, component_id, chan, msg, fo_gyro->state, fo_gyro->wib, fo_gyro->temprature);
}

/**
 * @brief Send a fo_gyro message
 * @param chan MAVLink channel to send the message
 *
 * @param state  state.
 * @param wib  wib.
 * @param temprature  temprature.
 */
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS

static inline void mavlink_msg_fo_gyro_send(mavlink_channel_t chan, int32_t state, const float *wib, float temprature)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_FO_GYRO_LEN];
    _mav_put_int32_t(buf, 0, state);
    _mav_put_float(buf, 16, temprature);
    _mav_put_float_array(buf, 4, wib, 3);
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FO_GYRO, buf, MAVLINK_MSG_ID_FO_GYRO_MIN_LEN, MAVLINK_MSG_ID_FO_GYRO_LEN, MAVLINK_MSG_ID_FO_GYRO_CRC);
#else
    mavlink_fo_gyro_t packet;
    packet.state = state;
    packet.temprature = temprature;
    mav_array_memcpy(packet.wib, wib, sizeof(float)*3);
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FO_GYRO, (const char *)&packet, MAVLINK_MSG_ID_FO_GYRO_MIN_LEN, MAVLINK_MSG_ID_FO_GYRO_LEN, MAVLINK_MSG_ID_FO_GYRO_CRC);
#endif
}

/**
 * @brief Send a fo_gyro message
 * @param chan MAVLink channel to send the message
 * @param struct The MAVLink struct to serialize
 */
static inline void mavlink_msg_fo_gyro_send_struct(mavlink_channel_t chan, const mavlink_fo_gyro_t* fo_gyro)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    mavlink_msg_fo_gyro_send(chan, fo_gyro->state, fo_gyro->wib, fo_gyro->temprature);
#else
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FO_GYRO, (const char *)fo_gyro, MAVLINK_MSG_ID_FO_GYRO_MIN_LEN, MAVLINK_MSG_ID_FO_GYRO_LEN, MAVLINK_MSG_ID_FO_GYRO_CRC);
#endif
}

#if MAVLINK_MSG_ID_FO_GYRO_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
  This varient of _send() can be used to save stack space by re-using
  memory from the receive buffer.  The caller provides a
  mavlink_message_t which is the size of a full mavlink message. This
  is usually the receive buffer for the channel, and allows a reply to an
  incoming message with minimum stack space usage.
 */
static inline void mavlink_msg_fo_gyro_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan,  int32_t state, const float *wib, float temprature)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char *buf = (char *)msgbuf;
    _mav_put_int32_t(buf, 0, state);
    _mav_put_float(buf, 16, temprature);
    _mav_put_float_array(buf, 4, wib, 3);
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FO_GYRO, buf, MAVLINK_MSG_ID_FO_GYRO_MIN_LEN, MAVLINK_MSG_ID_FO_GYRO_LEN, MAVLINK_MSG_ID_FO_GYRO_CRC);
#else
    mavlink_fo_gyro_t *packet = (mavlink_fo_gyro_t *)msgbuf;
    packet->state = state;
    packet->temprature = temprature;
    mav_array_memcpy(packet->wib, wib, sizeof(float)*3);
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FO_GYRO, (const char *)packet, MAVLINK_MSG_ID_FO_GYRO_MIN_LEN, MAVLINK_MSG_ID_FO_GYRO_LEN, MAVLINK_MSG_ID_FO_GYRO_CRC);
#endif
}
#endif

#endif

// MESSAGE FO_GYRO UNPACKING


/**
 * @brief Get field state from fo_gyro message
 *
 * @return  state.
 */
static inline int32_t mavlink_msg_fo_gyro_get_state(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int32_t(msg,  0);
}

/**
 * @brief Get field wib from fo_gyro message
 *
 * @return  wib.
 */
static inline uint16_t mavlink_msg_fo_gyro_get_wib(const mavlink_message_t* msg, float *wib)
{
    return _MAV_RETURN_float_array(msg, wib, 3,  4);
}

/**
 * @brief Get field temprature from fo_gyro message
 *
 * @return  temprature.
 */
static inline float mavlink_msg_fo_gyro_get_temprature(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  16);
}

/**
 * @brief Decode a fo_gyro message into a struct
 *
 * @param msg The message to decode
 * @param fo_gyro C-struct to decode the message contents into
 */
static inline void mavlink_msg_fo_gyro_decode(const mavlink_message_t* msg, mavlink_fo_gyro_t* fo_gyro)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    fo_gyro->state = mavlink_msg_fo_gyro_get_state(msg);
    mavlink_msg_fo_gyro_get_wib(msg, fo_gyro->wib);
    fo_gyro->temprature = mavlink_msg_fo_gyro_get_temprature(msg);
#else
        uint8_t len = msg->len < MAVLINK_MSG_ID_FO_GYRO_LEN? msg->len : MAVLINK_MSG_ID_FO_GYRO_LEN;
        memset(fo_gyro, 0, MAVLINK_MSG_ID_FO_GYRO_LEN);
    memcpy(fo_gyro, _MAV_PAYLOAD(msg), len);
#endif
}
